import PureUserDevTeams from '../components/user-dev-teams';
import * as DevTeamAction from 'actions/dev-team';
import { getFetchStatus } from 'actions/util';
import * as React from 'react';
import * as ReactRedux from 'react-redux';

const mapStateToProps = (state) => {
  return {
    isFetching: getFetchStatus(state, DevTeamAction.listByCurrentUser),
    devTeams: state.currentUserDevTeamList
  };
};

class UserDevTeams extends React.Component {
  componentDidMount() {
    this.props.dispatch(DevTeamAction.listByCurrentUser());
  }

  render() {
    return <PureUserDevTeams {...this.props}/>;
  }
}

export default ReactRedux.connect(mapStateToProps)(UserDevTeams);
